package coba.util;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class MainProperties {

	private static MainProperties INSTANCE = null;
	private Properties properties = null;

	private MainProperties() throws IOException {
		properties = new Properties();

		File f = new File("/opt/liferay/portal-setup-wizard.properties");

		if (!f.exists()) {
			f = new File("/Users/tito/Development/conociendoba/liferay-portal-6.2-ce-ga2/portal-setup-wizard.properties");
		}
		
		InputStream is = new FileInputStream(f);
		properties.load(is);
		is.close();
		//else {
			//properties.load(ClassLoader.getSystemClassLoader().getResourceAsStream("main.properties"));
		//}
	}

	public static synchronized MainProperties getInstance() throws IOException {
		if (INSTANCE == null)
			INSTANCE = new MainProperties();

		return INSTANCE;
	}

	public String getProperty(String name) {
		return properties.getProperty(name);
	}

}
